<template>
  <div class="member-info">
    <div class="member-info__title"></div>
    <div class="member-info__body">
      <!-- 文件助手 -->
      <!-- <Avatar class="member-info__body__avatar" :size="89" :src="selectMember.avatar"
      >
        <img src="../../../../assets/picture/file-t.svg"/>
      </Avatar> -->
       <el-avatar :size="100" :src="selectMember.avatar" class="member-info__body__avatar">
        <img src="../../../../assets/picture/defaultAvatar.png"/>
      </el-avatar>
      <span
        class="member-info__body__name"
      >{{ selectMember.nickName ? selectMember.nickName : selectMember.name }}</span>
      <div class="member-info__body__option">
        <el-button
          class="member-info__body__option__button"
          type="primary"
          round
          @click="toChat"
        >发起聊天</el-button>
        <!-- <img src="../../../../assets/picture/发消息@2x.png" @click="toChat" /> -->
        <!-- <img src="../../../assets/picture/加密@2x.png" /> -->
        <!-- <img src="../../../assets/picture/电话@2x.png" />
        <img src="../../../assets/picture/视频@2x.png" />-->
      </div>
      <div class="member-info__body__info">
        <div class="member-info__body__info__cell">
          <span class="member-info__body__info__cell__label">ID</span>
          <span
            class="member-info__body__info__cell__vale"
          >{{ selectMember.uid }}</span>
        </div>
        <div class="member-info__body__info__cell">
          <span class="member-info__body__info__cell__label">昵称</span>
          <span class="member-info__body__info__cell__vale">{{ selectMember.name }}</span>
        </div>
        <div class="member-info__body__info__cell">
          <span class="member-info__body__info__cell__label">备注</span>
          <span
            class="member-info__body__info__cell__vale"
          >{{ selectMember.nickName ? selectMember.nickName : '无' }}</span>
        </div>
        <!-- <div class="member-info__body__info__cell">
          <span class="member-info__body__info__cell__label">地区</span>
          <span
            class="member-info__body__info__cell__vale"
          >{{ selectMember.region ? selectMember.region : '未知' }}</span>
        </div> -->
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
import _ from 'lodash'
export default {
  components: { },
  computed: {
    ...mapState('app', ['selectMember', 'chatList'])
  },
  methods: {
    toChat () {
      const roomId = this.selectMember.roomId.toString()
      const _chatList = _.cloneDeep(this.chatList)
      if (_.isUndefined(_chatList[roomId])) {
        this.$store.dispatch('app/addChatList', roomId)
      }
      this.$store.dispatch('app/setRoomId', roomId)
      this.$store.dispatch('app/setChatPanelType', 'chat')
      this.$store.dispatch('app/setChatListVisible', true)
    }
  }
}
</script>

<style lang="scss" scoped>
.member-info {
  &__title {
    height: 51px;
    width: 100%;
    border-bottom: 1px solid #eee;
  }
  &__body {
    width: 100%;
    height: calc(100% - 51px);
    display: flex;
    flex-direction: column;
    align-items: center;
    &__avatar {
      margin-top: 69px;
      margin-bottom: 14px;
    }
    &__name {
      font-size: 18px;
      font-family: Source Han Sans CN;
      font-weight: 500;
      margin-bottom: 37px;
    }
    &__option {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 315px;
      user-select: none;
      margin-bottom: 39px;
      img {
        cursor: pointer;
        width: 45px;
        height: 45px;
      }
      // &__button {
      //   // position: absolute;
      //   // top: 300px;
      // }
    }
    &__info {
      width: 315px;
      &__cell {
        margin-bottom: 13px;
        width: 100%;
        display: flex;
        &__label {
          font-size: 13px;
          font-family: Source Han Sans CN;
          font-weight: 400;
          color: rgba(153, 153, 153, 1);
          margin-right: 28px;
          width: 26px;
        }
        &__vale {
          font-size: 13px;
          font-family: Source Han Sans CN;
          font-weight: 400;
          width: 260px;
          overflow: hidden;
        }
      }
    }
  }
}
</style>
